Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skip document during indexing if error occurs #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tonysun83
Copy link
Contributor

When an error is returned by search3-java, we handle it by throwing a
generic bad_request exception. This is the error handling path for both
search and indexing requests. During indexing however, the exception is
not caught and it leads to a search_worker_manager process crash. The
process is restarted by the search3_sup supervisor and the indexing
begins again. This leads to an endless loop of trying to index the same
document if the documents causes some sort of error. We modify this
behavior by catching the thrown exception and ignoring the document.

When an error is returned by search3-java, we handle it by throwing a
generic bad_request exception. This is the error handling path for both
search and indexing requests. During indexing however, the exception is
not caught and it leads to a search_worker_manager process crash. The
process is restarted by the search3_sup supervisor and the indexing
begins again. This leads to an endless loop of trying to index the same
document if the documents causes some sort of error. We modify this
behavior by catching the thrown exception and ignoring the document.
@tonysun83 tonysun83 changed the title skip error during indexing skip document during indexing if error occurs Nov 4, 2019
Copy link
Contributor

@rnewson rnewson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sidenote: verify_same_session is more idiomatically written as

% Session Verification
verify_same_session(Session, Session) when is_binary(Session) ->
    Session;
verify_same_session(_, _) ->
    throw(session_mismatch).

@@ -131,6 +132,12 @@ handle_response({ok, #{session := Session} = Response, _},
handle_response({error, Error}, _) ->
handle_error_response({error, Error}).

handle_update_response({ok, #{session := Session}, _}, CurrentSession) ->
VSession = verify_same_session(CurrentSession, Session),
VSession;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't look like the right result. handle_response returns {VSession, Response} above, for example.

Copy link
Contributor Author

@tonysun83 tonysun83 Nov 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rnewson handle_response was a generic handler and Response was need for other rpc requests. However in the case of updates, Response isn't needed, so I removed it.

@rnewson rnewson self-requested a review November 4, 2019 23:38
Copy link
Contributor

@rnewson rnewson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants